﻿using AiShou.BLL;
using AiShou.IBLL;
using AiShou.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AiShou.WebSite
{
    public partial class MyVideos : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // 获取用户Id
                TBUsers user = IdentityManager.ReadUser();
                if (user==null)
                {
                    Response.Redirect("login.aspx?ReturnUrl=MyVideos.aspx");

                }
                int userId = user.Id;
                // 查询视频
                IVideoManager videoManager = new VideoManager();
                List<TBVideos> videos = videoManager.GetVideosByUserId(userId).ReadResult();
                // 绑定到页面
                this.rptVideos.DataSource = videos;
                this.rptVideos.DataBind();
            }
        }

        /// <summary>
        /// 获取视频状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        protected string GetVideoStatus(int status)
        {
            switch (status)
            {
                case 1:
                    return "上传中";
                case 2:
                    return "上传失败";
                case 3:
                    return "上传完成";
                case 4:
                    return "转码中";
                case 5:
                    return "转码失败";
                case 6:
                    return "屏蔽";
                case 7:
                    return "正常";
                case 0:
                default:
                    return "未知";
            }
        }
    }
}